<template>
  <tbody>
    <tr v-for="(item, index) in arr" :key="index">
      <th><input type="checkbox" v-model="item.checked" /></th>
      <th>{{ item.name }}</th>
      <th>{{ item.price }}</th>
      <th>
        <button @click="item.num--" :disabled="item.num <= 0 ? true : false">
          -</button
        >{{ item.num }}<button @click="item.num++">+</button>
      </th>
      <th>{{ item.price * item.num }}</th>
      <th><button @click="shanchu(index)">删除</button></th>
    </tr>
  </tbody>
</template>

<script>
export default {
  props: { arr: Array },
  computed: {},
  methods: {
    shanchu(index) {
      this.$emit("delItem", index);
    },
  },
};
</script>

<style>
</style>